<?php
namespace app\shop\controller;
use think\Controller;
use think\request;
use think\Db;
class Common extends Controller{
	public function _initialize(){
		if(!session('user_id')){
			$redirect_uri="https://www.jfzhiwen.com/shop/ali/getuser";
			$url="https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2018112662334699&scope=auth_user&redirect_uri=$redirect_uri";
			header("Location:".$url);
		}else{
			$userinfo=Db::table('zz_user')->where('user_id',session('user_id'))->find();
			
			if(empty($userinfo)){
				//未关注用户
				header("Location:http://p.alipay.com/P/YnjVZZRm");
				return ;
			}else{
				//取消关注用户
				if($userinfo["is_follow"]=="F"){
					header("Location:http://p.alipay.com/P/YnjVZZRm");
					return ;
				}
				
			}
		}
		
	}
	
}